import java.util.Arrays;

public class Test1 {
    public static void sort(Comparable[] comparables) {
        for (int i = 0; i < comparables.length - 1; i++) {
            for (int j = 0; j < comparables.length - 1 - i; j++) {
                if(comparables[j].compareTo(comparables[j+1]) > 0) {
                    Comparable temp = comparables[j];
                    comparables[j] = comparables[j+1];
                    comparables[j+1] = temp;
                }
            }
        }
    }
    public static void main(String[] args) {
        Student[] students = new Student[3];
        students[0] = new Student("张三",29,198.6);
        students[1] = new Student("赵四",23,167.6);
        students[2] = new Student("王五",21,456.6);

        sort(students);

       // Arrays.sort(students);

        System.out.println(Arrays.toString(students));
    }
}
